﻿using AntdUI;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace DataTurnClient.Model
{
    [SugarTable("RouteLine")]
    public class RouteLine: INotifyPropertyChanged
    {
        [SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
        public int Id
        {
            get => _Id;
            set
            {
                _Id = value;
                NotifyPropertyChanged();
            }
        }
        private int _Id;

        [SugarColumn(ColumnDataType = "varchar(25)", IsNullable = false)]
        public string Ip
        {
            get => _Ip;
            set
            {
                _Ip = value;
                NotifyPropertyChanged();
            }
        }
        private string _Ip;

        [SugarColumn(ColumnDataType = "varchar(7)", IsNullable = false)]
        public string Port
        {
            get => _Port;
            set
            {
                _Port = value;
                NotifyPropertyChanged();
            }
        }
        private string _Port;

        [SugarColumn(ColumnDataType = "varchar(20)", IsNullable = false)]
        public string Path
        {
            get => _Path;
            set
            {
                _Path = value;
                NotifyPropertyChanged();
            }
        }
        private string _Path;

        [JsonIgnore]
        [SugarColumn(IsIgnore =true)]
        public CellLink[] CellLinks
        {
            get { return cellLinks; }
            set
            {
                if (cellLinks == value) return;
                cellLinks = value;
                NotifyPropertyChanged();
            }
        }
        private CellLink[] cellLinks;

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); //实现通知刷新
        }
    }
}
